/*
  Name: MiniClientCanvas.h
  Copyright: 
  Author: Carl Chatfield
  Date: 23/01/08 19:47
  Description: GL canvas for drawing mini client to
*/


#ifndef __MINICLIENTCANVAS_H__
#define __MINICLIENTCANVAS_H__

#ifdef __BORLANDC__
	#pragma hdrstop
#endif

#ifndef WX_PRECOMP
	#include <wx/wx.h>
#else
	#include <wx/wxprec.h>
#endif
#include "DeadProxyGUIEvent.h"
#include <wx/glcanvas.h>
#include <wx/gdicmn.h>


class MiniClientCanvas : public wxGLCanvas
{
    private:
        int width;
        int height;
        wxGLContext * RCContext;
        struct TextLog
        {
            unsigned int Pos;
            int SpriteId[23260];
        };
        TextLog * Log1;
        TextLog * Log2;
        TextLog * LogDumb;
        struct Text
        {
            GLuint name;
            unsigned int lastpos;
            int used;
        };
        Text * texture;
    public:
    	MiniClientCanvas(wxWindow* parent, 
                         wxWindowID id = wxID_ANY, 
                         int* attribList = 0, 
                         const wxPoint& pos = wxDefaultPosition, 
                         const wxSize& size = wxDefaultSize, 
                         long style=0, 
                         const wxString& name="ClientMiniCanvas", 
                         const wxPalette& palette = wxNullPalette);
    	virtual ~MiniClientCanvas();
    
    	// Methods
    	void InitGL();
        void Draw(void * pClient);
        void Paint(wxDC &dc);
        void BindTexture(int SpriteId);
        void UpdateTextureLog();
        
        // Event Handlers (These Functions Should NOT be Virtual)

        void OnPaint(wxPaintEvent& event);
        void OnDraw(wxGUIEvent & event);
//    	void OnLeftMouse(wxMouseEvent& event);
//    	void OnLeftMouseUp(wxMouseEvent& event);
//    	void OnRightMouse(wxMouseEvent& event);
//    	void OnRightMouseUp(wxMouseEvent& event);
//    	void OnMouseMove(wxMouseEvent& event);
//    	void OnSize(wxSizeEvent& event);
    	void OnEraseBackground(wxEraseEvent& event);
    	void OnIdle(wxIdleEvent& event);
        
        DECLARE_EVENT_TABLE()
};

#endif
